"""Entry points for wsgistate."""

from wsgistate.cache import WsgiMemoize


def make_simple_cache(app, global_conf, *args, **kwargs):
    from wsgistate.simple import SimpleCache
    cache = SimpleCache(*args, **kwargs)
    return WsgiMemoize(app, cache, key_user_info=True)

def make_memory_cache(app, global_conf, *args, **kwargs):
    from wsgistate.memory import MemoryCache
    cache = MemoryCache(*args, **kwargs)
    return WsgiMemoize(app, cache, key_user_info=True)

def make_file_cache(app, global_conf, cache_dir, *args, **kwargs):
    from wsgistate.file import FileCache
    cache = FileCache(cache_dir, *args, **kwargs)
    return WsgiMemoize(app, cache, key_user_info=True)

def make_memcached(app, global_conf, host, *args, **kwargs):
    from wsgistate.memcached import MemCached
    cache = MemCached(host, *args, **kwargs)
    return WsgiMemoize(app, cache, key_user_info=True)

def make_db_cache(app, global_conf, dsn, *args, **kwargs):
    from wsgistate.db import DbCache
    cache = DbCache(dsn, *args, **kwargs)
    return WsgiMemoize(app, cache, key_user_info=True)
